#ifndef FRAME_H
#define FRAME_H


#include<iostream>
#include"cmd.h"
#include"data.h"


//帧头
typedef struct framehdr{
	uint8_t SOF;
	uint16_t daga_length;
	uint8_t seq;
	uint8_t CRC8;
}FrameHeader;


void fill_frame_header(FrameHeader* frame_header,uint16_t cmd_id,uint16_t x=0){
	frame_header->SOF = 0xA5;
	uint16_t datalen=0;
	switch (cmd_id) {
	case EXT_GAME_STATUS:
		datalen = 11;
		break;
	case EXT_GAME_RESULT:
		datalen = 1;
		break;
	case EXT_EVENT_DATA:
		datalen = 4;
		break;
	case EXT_SUPPLY_PROJECTILE_ACTION:
		datalen = 3;
		break;
	case EXT_REFEREE_WARNING:
		datalen = 2;
		break;
	case EXT_GAME_ROBOT_STATUS:
		datalen = 15;
		break;
	case EXT_POWER_HEAT_DATA:
		datalen = 14;
		break;
	case EXT_GAME_ROBOT_POS:
		datalen = 16;
		break;
	case EXT_BUFF:
		datalen = 1;
		break;
	case EXT_ROBOT_HURT:
		datalen = 1;
		break;
	case EXT_SHOOT_DATA:
		datalen = 1;
		break;
	case EXT_RFID_STATUS:
		datalen = 4;
		break;
	case EXT_STUDENT_INTERACTIVE_HEADER_DATA:
		datalen = 6+x;
		break;
	default:
		break;
	}
	frame_header->daga_length = datalen;
}

void fill_EXT_GAME_STATUS_data(char *frame_data,uint16_t &datasize){	
	FrameHeader *frame_header;
	uint16_t cmd_id = EXT_GAME_STATUS;
	ext_game_result_t *data;
	frame_header = (FrameHeader*)frame_data;
	fill_frame_header(frame_header,cmd_id);
	
	
	
	
	
}



#endif
